"""
Web
"""

import streamlit as st

class ProgressBar:
    """"""
    
    def __init__(self):
        self.progress_bar = None
        self.status_text = None
    
    def render(self):
        """"""
        self.progress_bar = st.progress(0)
        self.status_text = st.empty()
        return self
    
    def update(self, value: int, message: str = ""):
        """"""
        if self.progress_bar:
            self.progress_bar.progress(value)
        if self.status_text:
            self.status_text.text(message)
    
    def complete(self, message: str = ""):
        """"""
        self.update(100, message)
    
    def error(self, message: str):
        """"""
        if self.status_text:
            self.status_text.error(message)